<template>
  <div class="app-container">
    <div class="toatst" style="width: 100%;height: 100%;position: fixed; z-index: 9999; " v-if="loadToast">
      <i class="el-icon-loading" style="font-size: 60px; position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); color: #000;"></i>
    </div>
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="入库编号" prop="inTaskNo">
        <el-input v-model="queryParams.inTaskNo" placeholder="请输入入库编号" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <!-- <el-form-item label="入库原因" prop="inWhSortCode">
				<el-input v-model="queryParams.inWhSortCode" placeholder="请输入入库原因" clearable
					@keyup.enter.native="handleQuery" />
			</el-form-item> -->
      <el-form-item label="操作人" prop="operationUserId">
        <el-select v-model="queryParams.operationUserId" placeholder="请选择操作人" clearable>
          <el-option v-for="item in userList" :key="item.userId" :label="item.nickName" :value="item.userId"></el-option>
        </el-select>
      </el-form-item>
      <!-- <el-form-item label="任务来源" prop="taskOrderType">
				<el-select v-model="queryParams.taskOrderType" placeholder="请选择任务状态" clearable>
					<el-option v-for="dict in dict.type.task_order_type" :key="dict.value" :label="dict.label"
						:value="dict.value"></el-option>
				</el-select>
			</el-form-item> -->
      <el-form-item label="任务状态" prop="statusCode">
        <el-select v-model="queryParams.statusCode" placeholder="请选择任务状态" clearable>
          <el-option v-for="dict in dict.type.in_wh_status_code" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
        </el-select>
      </el-form-item>
      <!-- <el-form-item label="任务时间">
        <el-date-picker v-model="dateRange1" type="datetimerange" :picker-options="pickerOptions" range-separator="至"
          start-placeholder="开始日期" end-placeholder="结束日期" value-format="yyyy-MM-dd HH:mm:ss">
        </el-date-picker>
      </el-form-item> -->
      <el-form-item label="操作时间">
        <el-date-picker v-model="dateRange2" type="datetimerange" :picker-options="pickerOptions" range-separator="至"
          start-placeholder="开始日期" end-placeholder="结束日期" value-format="yyyy-MM-dd HH:mm:ss">
        </el-date-picker>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['meter:mdInTask:add']">新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="success" plain icon="el-icon-switch-button" size="mini" :disabled="single" @click="startExecution"
          v-hasPermi="['meter:mdInTask:editStatus']">开始执行</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="warning" plain icon="el-icon-finished" size="mini" :disabled="single" @click="accomplished"
          v-hasPermi="['meter:mdInTask:editStatus']">任务完成</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="primary" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate"
          v-hasPermi="['meter:mdInTask:edit']">修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
          v-hasPermi="['meter:mdInTask:remove']">删除</el-button>
      </el-col>
      <!--  <el-col :span="1.5">
        <el-button type="success" plain icon="el-icon-sort" size="mini" @click="downloadData" v-hasPermi="['meter:mdInTask:downloadJsonMdInTask']">下载数据</el-button>
      </el-col> -->
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="mdInTaskList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="入库标识" align="center" prop="inTaskId" />
      <el-table-column label="入库编号" align="center" prop="inTaskNo" min-width="200px" />
      <!-- 	<el-table-column label="申请单号" align="center" prop="relaId" min-width="200px" />-->
      <!-- <el-table-column label="入库原因" align="center" prop="inWhSortCode" min-width="250px" /> -->
      <el-table-column label="操作人" align="center" prop="nickName" min-width="90px" />
      <el-table-column label="操作时间" align="center" prop="operationDate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.operationDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="任务状态" align="center" prop="statusCode">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.in_wh_status_code" :value="scope.row.statusCode" />
        </template>
      </el-table-column>
      <!-- <el-table-column label="任务来源" align="center" prop="taskOrderType">
				<template slot-scope="scope">
					<dict-tag :options="dict.type.task_order_type" :value="scope.row.taskOrderType" />
				</template>
			</el-table-column> -->
      <!-- <el-table-column label="任务时间" align="center" prop="taskDate" width="180">
				<template slot-scope="scope">
					<span>{{ parseTime(scope.row.taskDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
				</template>
			</el-table-column> -->
      <el-table-column label="资产大类" align="center" prop="assetsCategory">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.md_assets_category" :value="scope.row.assetsCategory" />
        </template>
      </el-table-column>
      <el-table-column label="备注" align="center" prop="remark" min-width="200px" />
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" min-width="350px">
        <template slot-scope="scope">
          <el-button size="mini" type="text" icon="el-icon-upload2" @click="handleImport(scope.row)" v-hasPermi="['meter:mdInTaskDetails:import']">导入</el-button>
          <el-button size="mini" type="text" icon="el-icon-download" @click="handleExport(scope.row)" v-hasPermi="['meter:mdInTaskDetails:export']">导出</el-button>
          <el-button size="mini" type="text" icon="el-icon-chat-line-square" @click="taskDetails(scope.row)" v-hasPermi="['meter:mdInTaskDetails:add']">添加明细</el-button>
          <!-- <el-button size="mini" type="text" icon="el-icon-document" @click="processingDetails(scope.row)" v-hasPermi="['meter:mdInTaskDetails:edit']">处理明细</el-button> -->
          <el-button size="mini" type="text" icon="el-icon-document" @click="watchDetailsInfo(scope.row)" v-hasPermi="['meter:mdInTaskDetails:edit']">查看详情</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
      @pagination="getList" />

    <!-- 添加或修改入库任务对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="入库编号" prop="inTaskNo">
          <el-input v-model="form.inTaskNo" placeholder="自动生成" readonly :disabled="true" />
        </el-form-item>
        <!-- <el-form-item label="入库原因" prop="inWhSortCode">
					<el-input v-model="form.inWhSortCode" placeholder="请输入入库原因" maxlength="50" />
				</el-form-item> -->
        <!-- 	<el-form-item label="操作人" prop="operationUserId">
					<el-select v-model="form.operationUserId" placeholder="请选择操作人">
						<el-option v-for="item in userList" :key="item.deptId" :label="item.nickName"
							:value="item.userId"></el-option>
					</el-select>
				</el-form-item> -->
        <!-- <el-form-item label="任务时间" prop="taskDate">
					<el-date-picker clearable v-model="form.taskDate" type="datetime" value-format="yyyy-MM-dd hh:mm:ss"
						placeholder="请选择任务时间">
					</el-date-picker>
				</el-form-item> -->
        <el-form-item label="资产大类" prop="assetsCategory">
          <el-select v-model="form.assetsCategory" placeholder="请选择资产大类" clearable :disabled="disableAssetCategory">
            <el-option v-for="dict in dict.type.md_assets_category" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="备注" prop="remark">
          <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>

    <!-- 导入对话框 -->
    <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
      <el-upload ref="upload" :limit="1" accept=".xlsx, .xls" :headers="upload.headers" :action="upload.url + '?isCoverSupport=' + upload.isCoverSupport + '&&inTaskNo=' + upload.inTaskNo"
        :disabled="upload.isUploading" :on-progress="handleFileUploadProgress" :on-success="handleFileSuccess"
        :auto-upload="false" drag>
        <i class="el-icon-upload"></i>
        <div class="el-upload__text">将文件拖到此处，或<em>点击上传</em></div>
        <div class="el-upload__tip text-center" slot="tip">
          <div class="el-upload__tip" slot="tip">
            <el-checkbox v-model="upload.isCoverSupport" /> 是否覆盖已经存在的数据
          </div>
          <span>仅允许导入xls、xlsx格式文件。</span>
          <el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;" @click="importTemplate"
            v-hasPermi="['meter:mdInTaskDetails:importTemplate']">下载模板</el-link>
        </div>
      </el-upload>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitFileForm">确 定</el-button>
        <el-button @click="upload.open = false">取 消</el-button>
      </div>
    </el-dialog>

    <!-- 添加明细对话框 -->
    <el-dialog :title="text" :visible.sync="opened" width="1200px" append-to-body @close='closeDetails'>
      <el-row :gutter="10" class="mb8">
        <el-col :span="1.5">
          <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="detailsAdd">添加</el-button>
        </el-col>
        <el-col :span="1.5">
          <el-button type="danger" plain icon="el-icon-delete" size="mini" @click="addDetailsDelete">删除</el-button>
        </el-col>
      </el-row>
      <el-table v-loading="loading" :data="electricInDetailsList" @selection-change="oneChange" v-if="asset == '01'">
        <el-table-column type="selection" width="55" align="center" />
        <el-table-column label="设备标识" align="center" prop="assetsId" />
        <el-table-column label="条形码" align="center" prop="rfidNo" min-width="220px" />
        <el-table-column label="设备码" align="center" prop="equipCode" min-width="220px" />
        <el-table-column label="设备名称" align="center" prop="equipName" min-width="550px" />
        <el-table-column label="出厂编号" align="center" prop="madeNo" />
        <el-table-column label="类别" align="center" prop="sortCode">
        </el-table-column>
        <el-table-column label="类型" align="center" prop="typeCode" />
        <!-- <el-table-column label="当前状态" align="center" prop="statusCode" min-width="100px">
					<template slot-scope="scope">
						<el-input v-model="scope.row.statusCode" placeholder="请输入当前状态"></el-input>
					</template>
				</el-table-column> -->
      </el-table>
      <el-table v-loading="loading" :data="transformerInDetailsList" @selection-change="twoChange" v-if="asset == '02'">
        <el-table-column type="selection" width="55" align="center" />
        <el-table-column label="设备标识" align="center" prop="assetsId" />
        <el-table-column label="条形码" align="center" prop="rfidNo" min-width="220px" />
        <el-table-column label="设备码" align="center" prop="equipCode" min-width="220px" />
        <el-table-column label="设备名称" align="center" prop="equipName" min-width="550px" />
        <el-table-column label="出厂编号" align="center" prop="madeNo" />
        <el-table-column label="类别" align="center" prop="sortCode">
          <template slot-scope="scope">
            <dict-tag :options="dict.type.tf_sort_code" :value="scope.row.sortCode" />
          </template>
        </el-table-column>
        <el-table-column label="类型" align="center" prop="typeCode" />
        <!-- <el-table-column label="当前状态" align="center" prop="statusCode" min-width="100px">
					<template slot-scope="scope">
						<el-input v-model="scope.row.statusCode" placeholder="请输入当前状态"></el-input>
					</template>
				</el-table-column> -->
      </el-table>
      <el-table v-loading="loading" :data="terminalInDetailsList" @selection-change="threeChange" v-if="asset == '03'">
        <el-table-column type="selection" width="55" align="center" />
        <el-table-column label="设备标识" align="center" prop="assetsId" />
        <el-table-column label="条形码" align="center" prop="rfidNo" min-width="220px" />
        <el-table-column label="设备码" align="center" prop="equipCode" min-width="220px" />
        <el-table-column label="设备名称" align="center" prop="equipName" min-width="550px" />
        <el-table-column label="出厂编号" align="center" prop="madeNo" min-width="220px" />
        <el-table-column label="型号" align="center" prop="modelCode" min-width="130px" />
        <el-table-column label="类型" align="center" prop="typeCode" />
        <!-- <el-table-column label="当前状态" align="center" prop="statusCode" min-width="100px">
					<template slot-scope="scope">
						<el-input v-model="scope.row.statusCode" placeholder="请输入当前状态"></el-input>
					</template>
				</el-table-column> -->
      </el-table>
      <el-table v-loading="loading" :data="moduleInDetailsList" @selection-change="fourChange" v-if="asset == '05'">
        <el-table-column type="selection" width="55" align="center" />
        <el-table-column label="设备标识" align="center" prop="assetsId" />
        <el-table-column label="条形码" align="center" prop="rfidNo" min-width="220px" />
        <el-table-column label="设备码" align="center" prop="equipCode" min-width="220px" />
        <el-table-column label="设备名称" align="center" prop="equipName" min-width="550px" />
        <el-table-column label="出厂编号" align="center" prop="madeNo" />
        <el-table-column label="关联设备类别" align="center" prop="assocCategory" min-width="110px" />
        <el-table-column label="关联设备条码号" align="center" prop="assocRfid" min-width="200px" />
        <!-- <el-table-column label="当前状态" align="center" prop="statusCode" min-width="100px">
					<template slot-scope="scope">
						<el-input v-model="scope.row.statusCode" placeholder="请输入当前状态"></el-input>
					</template>
				</el-table-column> -->
      </el-table>
      <el-table v-loading="loading" :data="concentratorInDetailsList" @selection-change="fiveChange" v-if="asset == '04'">
        <el-table-column type="selection" width="55" align="center" />
        <el-table-column label="设备标识" align="center" prop="assetsId" />
        <el-table-column label="条形码" align="center" prop="rfidNo" min-width="220px" />
        <el-table-column label="设备码" align="center" prop="equipCode" min-width="220px" />
        <el-table-column label="设备名称" align="center" prop="equipName" min-width="550px" />
        <el-table-column label="出厂编号" align="center" prop="madeNo" min-width="220px" />
        <el-table-column label="类型" align="center" prop="typeCode" />
        <el-table-column label="型号" align="center" prop="modelCode" min-width="180px" />
        <!-- <el-table-column label="当前状态" align="center" prop="statusCode" min-width="100px">
					<template slot-scope="scope">
						<el-input v-model="scope.row.statusCode" placeholder="请输入当前状态"></el-input>
					</template>
				</el-table-column> -->
      </el-table>
      <el-table v-loading="loading" :data="otherInDetailsList" @selection-change="sixChange" v-if="asset == '10'">
        <el-table-column type="selection" width="55" align="center" />
        <el-table-column label="设备标识" align="center" prop="assetsId" />
        <el-table-column label="设备类别" align="center" prop="equipCateg" />
        <el-table-column label="设备条形码" align="center" prop="rfidNo" />
        <el-table-column label="设备码" align="center" prop="equipCode" min-width="220px" />
        <el-table-column label="设备名称" align="center" prop="equipName" min-width="550px" />
        <!-- <el-table-column label="当前状态" align="center" prop="statusCode" min-width="100px">
					<template slot-scope="scope">
						<el-input v-model="scope.row.statusCode" placeholder="请输入当前状态"></el-input>
					</template>
				</el-table-column> -->
      </el-table>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="beSure">确 定</el-button>
        <el-button @click="closeDetails">取 消</el-button>
      </div>
    </el-dialog>

    <!-- 添加任务明细对话框 -->
    <el-dialog :title="topic" :visible.sync="untie" width="1200px" append-to-body>
      <el-table v-loading="loading" :data="detailsAddList" @selection-change="addDetailsSelectionChange" v-if="asset == '01'">
        <el-table-column type="selection" width="55" align="center" />
        <el-table-column label="设备标识" align="center" prop="meterId" />
        <el-table-column label="条形码" align="center" prop="rfidNo" min-width="220px" />
        <el-table-column label="设备码" align="center" prop="equipCode" min-width="220px" />
        <el-table-column label="设备名称" align="center" prop="equipName" min-width="550px" />
        <el-table-column label="出厂编号" align="center" prop="madeNo" />
        <el-table-column label="类别" align="center" prop="sortCode">
          <template slot-scope="scope">
            <dict-tag :options="dict.type.emi_meter_sort" :value="scope.row.sortCode" />
          </template>
        </el-table-column>
        <el-table-column label="类型" align="center" prop="typeCode" />
        <el-table-column label="业务状态" align="center" prop="serviceStatus" min-width="100px">
          <template slot-scope="scope">
            <dict-tag :options="dict.type.service_status" :value="scope.row.serviceStatus" />
          </template>
        </el-table-column>
      </el-table>
      <el-table v-loading="loading" :data="detailsAddList" @selection-change="addTransformerDetailsSelectionChange"
        v-if="asset == '02'">
        <el-table-column type="selection" width="55" align="center" />
        <el-table-column label="设备标识" align="center" prop="itId" />
        <el-table-column label="条形码" align="center" prop="rfidNo" min-width="220px" />
        <el-table-column label="设备码" align="center" prop="equipCode" min-width="220px" />
        <el-table-column label="设备名称" align="center" prop="equipName" min-width="550px" />
        <el-table-column label="出厂编号" align="center" prop="madeNo" />
        <el-table-column label="类别" align="center" prop="sortCode">
          <template slot-scope="scope">
            <dict-tag :options="dict.type.tf_sort_code" :value="scope.row.sortCode" />
          </template>
        </el-table-column>
        <el-table-column label="类型" align="center" prop="typeCode" />
        <el-table-column label="业务状态" align="center" prop="serviceStatus" min-width="100px">
          <template slot-scope="scope">
            <dict-tag :options="dict.type.service_status" :value="scope.row.serviceStatus" />
          </template>
        </el-table-column>
      </el-table>
      <el-table v-loading="loading" :data="detailsAddList" @selection-change="addAcquisitionDetailsSelectionChange"
        v-if="asset == '03'">
        <el-table-column type="selection" width="55" align="center" />
        <el-table-column label="设备标识" align="center" prop="lcEquipId" />
        <el-table-column label="条形码" align="center" prop="rfidNo" min-width="220px" />
        <el-table-column label="设备码" align="center" prop="equipCode" min-width="220px" />
        <el-table-column label="设备名称" align="center" prop="equipName" min-width="550px" />
        <el-table-column label="出厂编号" align="center" prop="madeNo" min-width="220px" />
        <el-table-column label="型号" align="center" prop="modelCode" min-width="130px" />
        <el-table-column label="类型" align="center" prop="typeCode" />
        <el-table-column label="业务状态" align="center" prop="serviceStatus" min-width="100px">
          <template slot-scope="scope">
            <dict-tag :options="dict.type.service_status" :value="scope.row.serviceStatus" />
          </template>
        </el-table-column>
      </el-table>
      <el-table v-loading="loading" :data="detailsAddList" @selection-change="addConcentratorDetailsSelectionChange"
        v-if="asset == '05'">
        <el-table-column type="selection" width="55" align="center" />
        <el-table-column label="设备标识" align="center" prop="moduleId" />
        <el-table-column label="条形码" align="center" prop="rfidNo" min-width="220px" />
        <el-table-column label="设备码" align="center" prop="equipCode" min-width="220px" />
        <el-table-column label="设备名称" align="center" prop="equipName" min-width="550px" />
        <el-table-column label="出厂编号" align="center" prop="madeNo" />
        <el-table-column label="关联设备类别" align="center" prop="assocCategory" min-width="110px" />
        <el-table-column label="关联设备条码号" align="center" prop="assocRfid" min-width="200px" />
        <el-table-column label="业务状态" align="center" prop="serviceStatus" min-width="100px">
          <template slot-scope="scope">
            <dict-tag :options="dict.type.service_status" :value="scope.row.serviceStatus" />
          </template>
        </el-table-column>
      </el-table>
      <el-table v-loading="loading" :data="detailsAddList" @selection-change="addCommunicationDetailsSelectionChange"
        v-if="asset == '04'">
        <el-table-column type="selection" width="55" align="center" />
        <el-table-column label="设备标识" align="center" prop="concentratorId" />
        <el-table-column label="条形码" align="center" prop="rfidNo" min-width="220px" />
        <el-table-column label="设备码" align="center" prop="equipCode" min-width="220px" />
        <el-table-column label="设备名称" align="center" prop="equipName" min-width="550px" />
        <el-table-column label="出厂编号" align="center" prop="madeNo" min-width="220px" />
        <el-table-column label="类型" align="center" prop="typeCode" />
        <el-table-column label="型号" align="center" prop="modelCode" min-width="180px" />
        <el-table-column label="业务状态" align="center" prop="serviceStatus" min-width="100px">
          <template slot-scope="scope">
            <dict-tag :options="dict.type.service_status" :value="scope.row.serviceStatus" />
          </template>
        </el-table-column>
      </el-table>
      <el-table v-loading="loading" :data="detailsAddList" @selection-change="addOtherDetailsSelectionChange" v-if="asset == '10'">
        <el-table-column type="selection" width="55" align="center" />
        <el-table-column label="设备标识" align="center" prop="otherMaterialId" />
        <el-table-column label="设备类别" align="center" prop="equipCateg" />
        <el-table-column label="设备条形码" align="center" prop="barCode" />
        <el-table-column label="设备码" align="center" prop="equipCode" min-width="220px" />
        <el-table-column label="设备名称" align="center" prop="equipName" min-width="550px" />
        <el-table-column label="业务状态" align="center" prop="serviceStatus" min-width="100px">
          <template slot-scope="scope">
            <dict-tag :options="dict.type.service_status" :value="scope.row.serviceStatus" />
          </template>
        </el-table-column>
      </el-table>
      <pagination v-show="num > 0" :total="num" :page.sync="queryParam.pageNum" :limit.sync="queryParam.pageSize"
        :page-sizes="[10, 50, 100, 500]" @pagination="detailsAdd" />
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="define">确 定</el-button>
        <el-button @click="untie = false">取 消</el-button>
      </div>
    </el-dialog>

    <!-- 处理明细弹出层 -->
    <el-dialog :title="processingText" :visible.sync="processing" width="1200px" append-to-body @close='closeProcessing'>
      <el-row :gutter="10" class="mb8">
        <el-col :span="1.5">
          <el-button type="primary" plain icon="el-icon-download" size="mini" :disabled="several" @click="warehousingExecution">入库执行</el-button>
        </el-col>
        <el-col :span="1.5">
          <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="several" @click="deleteProcessingDetails">删除</el-button>
        </el-col>
      </el-row>
      <el-table v-loading="loading" :data="detailsList" @selection-change="processDetails" v-if="cateGory == '01'">
        <el-table-column type="selection" width="55" align="center" :selectable="selectedChange" />
        <el-table-column label="设备标识" align="center" prop="assetsId" />
        <el-table-column label="条形码" align="center" prop="rfidNo" min-width="200px" />
        <el-table-column label="设备码" align="center" prop="equipCode" min-width="220px" />
        <el-table-column label="设备名称" align="center" prop="equipName" min-width="550px" />
        <el-table-column label="类别" align="center" prop="sortCode">
        </el-table-column>
        <el-table-column label="类型" align="center" prop="typeCode" min-width="140px" />
        <!--  <el-table-column label="库房" align="center" prop="whName" min-width="200px" />
        <el-table-column label="库区" align="center" prop="whAreaName" min-width="150px" />
        <el-table-column label="存放区" align="center" prop="storeAreaName" min-width="110px" />
        <el-table-column label="储位编号" align="center" prop="storeLocNo" min-width="110px" />
        <el-table-column label="储位" align="center" prop="storeLocName" min-width="110px" /> -->
        <el-table-column label="是否完成" align="center" prop="isComplete">
          <template slot-scope="scope">
            <dict-tag :options="dict.type.in_is_complete" :value="scope.row.isComplete" />
          </template>
        </el-table-column>
        <el-table-column label="完成时间" align="center" prop="operationDate" width="180">
          <template slot-scope="scope">
            <span>{{ parseTime(scope.row.operationDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
          </template>
        </el-table-column>
        <!-- <el-table-column label="是否正常入库" align="center" prop="isNormal" width="180">
          <template slot-scope="scope">
            <dict-tag :options="dict.type.md_is_normal" :value="scope.row.isNormal" />
          </template>
        </el-table-column> -->
      </el-table>
      <el-table v-loading="loading" :data="detailsList" @selection-change="processDetails" v-if="cateGory == '02'">
        <el-table-column type="selection" width="55" align="center" :selectable="selectedChange" />
        <el-table-column label="设备标识" align="center" prop="assetsId" />
        <el-table-column label="条形码" align="center" prop="rfidNo" min-width="200px" />
        <el-table-column label="设备码" align="center" prop="equipCode" min-width="220px" />
        <el-table-column label="设备名称" align="center" prop="equipName" min-width="550px" />
        <el-table-column label="类别" align="center" prop="sortCode" min-width="140px">
          <template slot-scope="scope">
            <dict-tag :options="dict.type.tf_sort_code" :value="scope.row.sortCode" />
          </template>
        </el-table-column>
        <el-table-column label="类型" align="center" prop="typeCode" min-width="140px" />
        <!--  <el-table-column label="库房" align="center" prop="whName" min-width="200px" />
        <el-table-column label="库区" align="center" prop="whAreaName" min-width="150px" />
        <el-table-column label="存放区" align="center" prop="storeAreaName" min-width="110px" />
        <el-table-column label="储位编号" align="center" prop="storeLocNo" min-width="110px" />
        <el-table-column label="储位" align="center" prop="storeLocName" min-width="110px" /> -->
        <el-table-column label="是否完成" align="center" prop="isComplete">
          <template slot-scope="scope">
            <dict-tag :options="dict.type.in_is_complete" :value="scope.row.isComplete" />
          </template>
        </el-table-column>
        <el-table-column label="完成时间" align="center" prop="operationDate" width="180">
          <template slot-scope="scope">
            <span>{{ parseTime(scope.row.operationDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
          </template>
        </el-table-column>
      </el-table>
      <el-table v-loading="loading" :data="detailsList" @selection-change="processDetails" v-if="cateGory != '02' && cateGory != '01'">
        <el-table-column type="selection" width="55" align="center" :selectable="selectedChange" />
        <el-table-column label="设备标识" align="center" prop="assetsId" />
        <el-table-column label="条形码" align="center" prop="rfidNo" min-width="200px" />
        <el-table-column label="设备码" align="center" prop="equipCode" min-width="220px" />
        <el-table-column label="设备名称" align="center" prop="equipName" min-width="550px" />
        <el-table-column label="类别" align="center" prop="sortCode" />
        <el-table-column label="类型" align="center" prop="typeCode" min-width="140px" />
        <!-- <el-table-column label="库房" align="center" prop="whName" min-width="200px" />
        <el-table-column label="库区" align="center" prop="whAreaName" min-width="150px" />
        <el-table-column label="存放区" align="center" prop="storeAreaName" min-width="110px" />
        <el-table-column label="储位编号" align="center" prop="storeLocNo" min-width="110px" />
        <el-table-column label="储位" align="center" prop="storeLocName" min-width="110px" /> -->
        <el-table-column label="是否完成" align="center" prop="isComplete">
          <template slot-scope="scope">
            <dict-tag :options="dict.type.in_is_complete" :value="scope.row.isComplete" />
          </template>
        </el-table-column>
        <el-table-column label="完成时间" align="center" prop="operationDate" width="180">
          <template slot-scope="scope">
            <span>{{ parseTime(scope.row.operationDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
          </template>
        </el-table-column>
      </el-table>
      <pagination v-show="figure > 0" :total="figure" :page.sync="inquireAbout.pageNum" :limit.sync="inquireAbout.pageSize"
        :page-sizes="[10, 50, 100, 500]" @pagination="processingDetail" />
      <div slot="footer" class="dialog-footer">
        <el-button @click="closeProcessing">返 回</el-button>
      </div>
    </el-dialog>

    <!-- 查看明细弹出层 -->
    <el-dialog :title="watchInfoText" :visible.sync="watchInfo" width="1200px" append-to-body @close='closeWatchInfo'>
      <el-table v-loading="loading" :data="detailsList" @selection-change="processDetails" v-if="cateGory == '01'">
        <el-table-column type="selection" width="55" align="center" :selectable="selectedChange" />
        <el-table-column label="设备标识" align="center" prop="assetsId" />
        <el-table-column label="条形码" align="center" prop="rfidNo" min-width="200px" />
        <el-table-column label="设备码" align="center" prop="equipCode" min-width="220px" />
        <el-table-column label="设备名称" align="center" prop="equipName" min-width="550px" />
        <el-table-column label="类别" align="center" prop="sortCode">
        </el-table-column>
        <el-table-column label="类型" align="center" prop="typeCode" min-width="140px" />
        <!-- <el-table-column label="库房" align="center" prop="whName" min-width="200px" /> -->
        <!-- <el-table-column label="库区" align="center" prop="whAreaName" min-width="150px" />
        <el-table-column label="存放区" align="center" prop="storeAreaName" min-width="110px" />
        <el-table-column label="储位编号" align="center" prop="storeLocNo" min-width="110px" />
        <el-table-column label="储位" align="center" prop="storeLocName" min-width="110px" /> -->
        <el-table-column label="是否完成" align="center" prop="isComplete">
          <template slot-scope="scope">
            <dict-tag :options="dict.type.in_is_complete" :value="scope.row.isComplete" />
          </template>
        </el-table-column>
        <el-table-column label="完成时间" align="center" prop="operationDate" width="180">
          <template slot-scope="scope">
            <span>{{ parseTime(scope.row.operationDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
          </template>
        </el-table-column>
        <!-- <el-table-column label="是否正常入库" align="center" prop="isNormal" width="180">
          <template slot-scope="scope">
            <dict-tag :options="dict.type.md_is_normal" :value="scope.row.isNormal" />
          </template>
        </el-table-column> -->
      </el-table>
      <el-table v-loading="loading" :data="detailsList" @selection-change="processDetails" v-if="cateGory == '02'">
        <el-table-column type="selection" width="55" align="center" :selectable="selectedChange" />
        <el-table-column label="设备标识" align="center" prop="assetsId" />
        <el-table-column label="条形码" align="center" prop="rfidNo" min-width="200px" />
        <el-table-column label="设备码" align="center" prop="equipCode" min-width="220px" />
        <el-table-column label="设备名称" align="center" prop="equipName" min-width="550px" />
        <el-table-column label="类别" align="center" prop="sortCode" min-width="140px">
          <template slot-scope="scope">
            <dict-tag :options="dict.type.tf_sort_code" :value="scope.row.sortCode" />
          </template>
        </el-table-column>
        <el-table-column label="类型" align="center" prop="typeCode" min-width="140px" />
        <!-- <el-table-column label="库房" align="center" prop="whName" min-width="200px" />
        <el-table-column label="库区" align="center" prop="whAreaName" min-width="150px" />
        <el-table-column label="存放区" align="center" prop="storeAreaName" min-width="110px" />
        <el-table-column label="储位编号" align="center" prop="storeLocNo" min-width="110px" />
        <el-table-column label="储位" align="center" prop="storeLocName" min-width="110px" /> -->
        <el-table-column label="是否完成" align="center" prop="isComplete">
          <template slot-scope="scope">
            <dict-tag :options="dict.type.in_is_complete" :value="scope.row.isComplete" />
          </template>
        </el-table-column>
        <el-table-column label="完成时间" align="center" prop="operationDate" width="180">
          <template slot-scope="scope">
            <span>{{ parseTime(scope.row.operationDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
          </template>
        </el-table-column>
      </el-table>
      <el-table v-loading="loading" :data="detailsList" @selection-change="processDetails" v-if="cateGory != '02' && cateGory != '01'">
        <el-table-column type="selection" width="55" align="center" :selectable="selectedChange" />
        <el-table-column label="设备标识" align="center" prop="assetsId" />
        <el-table-column label="条形码" align="center" prop="rfidNo" min-width="200px" />
        <el-table-column label="设备码" align="center" prop="equipCode" min-width="220px" />
        <el-table-column label="设备名称" align="center" prop="equipName" min-width="550px" />
        <el-table-column label="类别" align="center" prop="sortCode" />
        <el-table-column label="类型" align="center" prop="typeCode" min-width="140px" />
        <!-- <el-table-column label="库房" align="center" prop="whName" min-width="200px" />
        <el-table-column label="库区" align="center" prop="whAreaName" min-width="150px" />
        <el-table-column label="存放区" align="center" prop="storeAreaName" min-width="110px" />
        <el-table-column label="储位编号" align="center" prop="storeLocNo" min-width="110px" />
        <el-table-column label="储位" align="center" prop="storeLocName" min-width="110px" /> -->
        <el-table-column label="是否完成" align="center" prop="isComplete">
          <template slot-scope="scope">
            <dict-tag :options="dict.type.in_is_complete" :value="scope.row.isComplete" />
          </template>
        </el-table-column>
        <el-table-column label="完成时间" align="center" prop="operationDate" width="180">
          <template slot-scope="scope">
            <span>{{ parseTime(scope.row.operationDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
          </template>
        </el-table-column>
      </el-table>
      <pagination v-show="figure > 0" :total="figure" :page.sync="inquireAbout.pageNum" :limit.sync="inquireAbout.pageSize"
        :page-sizes="[10, 50, 100, 500]" @pagination="processingDetail" />
      <div slot="footer" class="dialog-footer">
        <el-button @click="closeWatchInfo">返 回</el-button>
      </div>
    </el-dialog>

    <el-dialog :title="carryOutText" :visible.sync="toast" width="500px" append-to-body @close='closeChoose'>
      <el-form ref="wareHouseForm" :model="wareHouseForm" :rules="rules" label-width="80px">
        <el-form-item label="库房" prop="whId">
          <el-select v-model="wareHouseForm.whId" placeholder="请选择库房" @change="changeWhId">
            <el-option v-for="item in option" :key="item.value" :label="item.label" :value="item.value"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="库区" prop="whAreaId">
          <el-select v-model="wareHouseForm.whAreaId" placeholder="请选择库区" @change="changeWhAreaId">
            <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="存放区" prop="storeAreaId">
          <el-select v-model="wareHouseForm.storeAreaId" placeholder="请选择存放区" @change="changeStoreAreaId">
            <el-option v-for="item in optionss" :key="item.value" :label="item.label" :value="item.value"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="储位" prop="storeLocId">
          <el-select v-model="wareHouseForm.storeLocId" placeholder="请选择储位">
            <el-option v-for="item in storageOption" :key="item.value" :label="item.label" :value="item.value"></el-option>
          </el-select>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="startBeSureExecution">确 定</el-button>
        <el-button @click="closeChoose">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
  import {
    listMdInTask,
    getMdInTask,
    delMdInTask,
    addMdInTask,
    updateMdInTask,
    modifyReceiptTaskstatus,
    queryDetailsList,
    delMdInTaskDetails,
    addReceiptDetails,
    startBeSureDetailsExecution,
    jsonMdInTask,
  } from "@/api/meter/mdInTask";
  import {
    getToken
  } from "@/utils/auth";
  import {
    listUser
  } from "@/api/system/user"
  import {
    listMdMeter
  } from "@/api/meter/mdMeter";
  import {
    listMdIt
  } from "@/api/meter/mdIt";
  import {
    listMdLcEquip
  } from "@/api/meter/mdLcEquip";
  import {
    listMdComModule
  } from "@/api/meter/mdComModule";
  import {
    listMdConcentrator
  } from "@/api/meter/mdConcentrator";
  import {
    listMdOtherMaterial
  } from "@/api/meter/mdOtherMaterial";
  import {
    selectMdWhInfo,
    selectMdStorageAreaInfo,
    selectMdSaInfo,
    selectStorageLocation
  } from "@/api/meter/mdWhInfo";

  export default {
    name: "MdInTask",
    dicts: ["in_wh_sort_code", "in_wh_status_code", "md_assets_category", "emi_meter_sort", "tf_sort_code",
      "service_status", "in_is_complete", "md_is_normal", "task_order_type"
    ],
    data() {
      return {
        // 遮罩层
        loading: true,
        // 选中数组
        ids: [],
        codeIds: [],
        // 日期范围
        dateRange1: [],
        dateRange2: [],
        //是否禁用
        disableAssetCategory: false,
        // 非单个禁用
        single: true,
        // 非多个禁用
        multiple: true,
        // 显示搜索条件
        showSearch: true,
        // 总条数
        total: 0,
        //上传时遮罩层
        loadToast: false,
        //处理明细中间库标识
        equipId: "",
        // 入库任务表格数据
        mdInTaskList: [],
        //添加电能表明细数据
        electricInDetailsList: [],
        // 弹出层标题
        title: "",
        // 是否显示弹出层
        open: false,
        //是否显示添加明细弹出层
        opened: false,
        //添加明细层标题
        text: "",
        //入库任务编号
        taskNo: "",
        //入库任务资产大类
        asset: "",
        //任务明细添加数据
        detailsAddList: [],
        transformerInDetailsList: [],
        terminalInDetailsList: [],
        moduleInDetailsList: [],
        concentratorInDetailsList: [],
        otherInDetailsList: [],
        //任务明细添加标题
        topic: "",
        //是否显示任务明细添加弹出层
        untie: false,
        //添加任务明细总条数
        num: 0,
        //添加任务明细选中数组
        detailsSelection: [],
        //选中数据数组
        selectionArray: [],
        //是否显示处理明细弹出层
        processing: false,
        //是否显示查看明细弹出层
        watchInfo: false,
        //处理明细层标题
        processingText: "",
        //处理明细层标题
        watchInfoText: "",
        //处理明细选中数组
        processingSelsctArray: [],
        //处理明细资产大类
        cateGory: "",
        //处理明细选中任务详情编号
        inTaskDetailsIds: "",
        //处理明细选中入库编号
        wareHousingNo: "",
        //处理明细非单个禁用
        alone: true,
        //处理明细非多个禁用
        several: true,
        //处理明细入库编号
        inTask: "",
        //单据来源
        taskOrderTypeCode: "",
        //处理明细总条数
        figure: 0,
        //处理明细查询参数
        inquireAbout: {
          pageNum: 1,
          pageSize: 10,
        },
        //处理明细入库ID
        taskId: "",
        //入库执行表单参数
        wareHouseForm: {
          whId: "",
          whAreaId: "",
          storeAreaId: "",
          storeLocId: ""
        },
        //执行表单集合
        houseForm: [],
        //选中数据
        detailsList: [],
        //入库执行标题
        carryOutText: "",
        //是否显示入库执行弹出层
        toast: false,
        //入库单主键
        characteristic: "",
        //添加明细查询参数
        queryParam: {
          pageNum: 1,
          pageSize: 10,
          serviceStatus: "00"
        },
        // 数据导入参数
        upload: {
          // 是否显示弹出层
          open: false,
          // 弹出层标题
          title: "",
          // 是否禁用上传
          isUploading: false,
          // 是否覆盖已经存在的数据
          isCoverSupport: 0,
          //入库编号
          inTaskNo: '',
          // 设置上传的请求头部
          headers: {
            Authorization: "Bearer " + getToken()
          },
          // 上传的地址
          url: process.env.VUE_APP_BASE_API + "/meter/mdInTaskDetails/importData"
        },
        // 查询参数
        queryParams: {
          pageNum: 1,
          pageSize: 10,
          inTaskNo: null,
          inWhSortCode: null,
          operationUserId: null,
          operationDate: null,
          statusCode: null,
          taskDate: null,
          assetsCategory: null,
          sender: null,
          receiver: null,
          originalDept: null,
          targetDept: null,
          taskOrderType: 2
        },
        // 表单参数
        form: {},
        // 表单校验
        rules: {
          // inTaskNo: [{
          //   required: true,
          //   message: '入库编号不能为空',
          //   trigger: 'blur'
          // }, {
          //   // min: 3,
          //   max: 50,
          //   message: '长度不得超过50个字符',
          //   trigger: 'blur'
          // }],
          // inWhSortCode: [{
          //   required: true,
          //   message: '入库原因不能为空',
          //   trigger: 'blur'
          // }, {
          //   // min: 3,
          //   max: 50,
          //   message: '长度不得超过50个字符',
          //   trigger: 'blur'
          // }],
          // operationUserId: [{
          // 	required: true,
          // 	message: '请选择操作人',
          // 	trigger: 'change'
          // }],
          assetsCategory: [{
            required: true,
            message: '请选择资产大类',
            trigger: 'change'
          }],
          // taskDate: [{
          //   required: true,
          //   message: '请选择任务时间',
          //   trigger: 'change'
          // }],
          // whId: [{
          //   required: true,
          //   message: '库房不能为空',
          //   trigger: 'change'
          // }],
          // whAreaId: [{
          //   required: true,
          //   message: '库区不能为空',
          //   trigger: 'change'
          // }],
          // storeAreaId: [{
          //   required: true,
          //   message: '存放区不能为空',
          //   trigger: 'change'
          // }],
          // storeLocId: [{
          //   required: true,
          //   message: '储位不能为空',
          //   trigger: 'change'
          // }],
        },
        //盘点人列表
        userList: [],
        //库房下拉框
        option: [],
        //库区下拉框
        options: [],
        //存放区下拉框
        optionss: [],
        //储位下拉框
        storageOption: [],
        pickerOptions: {
          shortcuts: [{
            text: '最近一周',
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
              picker.$emit('pick', [start, end]);
            }
          }, {
            text: '最近一个月',
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
              picker.$emit('pick', [start, end]);
            }
          }, {
            text: '最近三个月',
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
              picker.$emit('pick', [start, end]);
            }
          }]
        },
      };
    },
    created() {
      this.getList();
    },
    methods: {
      //处理禁止选择方法
      selectedChange(row) {
        if (row.isComplete == "0") {
          return true
        } else {
          return false
        }
      },
      /** 查询入库任务列表 */
      getList() {
        this.loading = true;
        listMdInTask(this.addDateRanges(this.queryParams, this.dateRange1, this.dateRange2)).then(response => {
          this.mdInTaskList = response.rows;
          this.total = response.total;
          this.loading = false;
        });
        const queryParam = {
          pageNum: 1,
          pageSize: 10
        }
        listUser(queryParam).then(response => {
          this.userList = response.rows
        })
      },
      // 取消按钮
      cancel() {
        this.open = false;
        this.reset();
      },
      // 表单重置
      reset() {
        this.form = {
          inTaskId: null,
          inTaskNo: null,
          inWhSortCode: null,
          operationUserId: null,
          operationDate: null,
          statusCode: null,
          taskDate: null,
          assetsCategory: null,
          remark: null,
          sender: null,
          receiver: null,
          originalDept: null,
          targetDept: null,
          taskOrderType: 2
        };
        this.resetForm("form");
      },
      /** 搜索按钮操作 */
      handleQuery() {
        this.queryParams.pageNum = 1;
        this.getList();
      },
      /** 重置按钮操作 */
      resetQuery() {
        this.dateRange1 = [];
        this.dateRange2 = [];
        this.resetForm("queryForm");
        this.handleQuery();
      },
      // 多选框选中数据
      handleSelectionChange(selection) {
        this.ids = selection.map(item => item.inTaskId)
        this.taskOrderTypeCode = selection.map(item => item.taskOrderType)
        this.codeIds = selection.map(item => item.statusCode)
        this.single = selection.length !== 1
        this.multiple = !selection.length
      },
      /** 新增按钮操作 */
      handleAdd() {
        this.reset();
        this.disableAssetCategory = false;
        this.open = true;
        this.title = "添加入库任务";
      },
      /** 修改按钮操作 */
      handleUpdate(row) {
        this.reset();
        this.disableAssetCategory = true;
        const inTaskId = row.inTaskId || this.ids
        getMdInTask(inTaskId).then(response => {
          this.form = response.data;
          this.open = true;
          this.title = "修改入库任务";
        });
      },
      /** 提交按钮 */
      submitForm() {
        if (this.title == "修改入库任务") {
          this.$refs["form"].validate(valid => {
            if (valid) {
              if (this.form.statusCode != 0) {
                this.$message.error('任务已执行中，不允许对数据进行修改');
              } else {
                updateMdInTask(this.form).then(response => {
                  this.$modal.msgSuccess("修改成功");
                  this.open = false;
                  this.getList();
                });
              }
            }
          });
        } else {
          this.$refs["form"].validate(valid => {
            if (valid) {
              addMdInTask(this.form).then(response => {
                this.$modal.msgSuccess("新增成功");
                this.open = false;
                this.getList();
              });
            }
          });
        }
      },
      /** 删除按钮操作 */
      handleDelete(row) {
        const inTaskIds = row.inTaskId || this.ids;
        var taskOrder = ""
        this.taskOrderTypeCode.forEach(item => {
          taskOrder = item
        })
        this.$modal.confirm('是否确认删除入库任务编号为"' + inTaskIds + '"的数据项？').then(function() {
          return delMdInTask(inTaskIds);
        }).then(() => {
          this.getList();
          this.$modal.msgSuccess("删除成功");
        }).catch(() => {});
      },
      /** 导出按钮操作 */
      handleExport(row) {
        const inTaskNo = row.inTaskNo
        this.download('meter/mdInTaskDetails/export', {
          inTaskNo
        }, `入库明细导出数据${inTaskNo}.xlsx`)
      },
      /** 导入按钮操作 */
      handleImport(row) {
        this.upload.title = "数据导入";
        this.upload.open = true;
        const inTaskNo = row.inTaskNo
        this.upload.inTaskNo = inTaskNo
      },
      /** 下载模板操作 */
      importTemplate() {
        this.download('meter/mdInTaskDetails/importTemplate', {}, `入库导入模板${new Date().getTime()}.xlsx`)
      },
      // 文件上传中处理
      handleFileUploadProgress(event, file, fileList) {
        this.loadToast = true
        this.upload.isUploading = true;
      },
      // 文件上传成功处理
      handleFileSuccess(response, file, fileList) {
        if (response.code == 200) {
          this.upload.open = false;
          this.upload.isUploading = false;
          this.$refs.upload.clearFiles();
          this.$alert(
            `<div style="overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;">${response.msg}</div>`,
            "导入结果", {
              dangerouslyUseHTMLString: true
            });
          this.loadToast = false
          this.getList();
        } else {
          this.upload.open = false;
          this.upload.isUploading = false;
          this.$refs.upload.clearFiles();
          this.$alert(
            `<div style="overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;">${response.msg}</div>`,
            "导入结果", {
              dangerouslyUseHTMLString: true
            });
          this.loadToast = false
          this.getList();
        }
      },
      // 提交上传文件
      submitFileForm() {
        this.$refs.upload.submit();
      },
      //修改入库任务状态
      startExecution(row) {
        const task = this.ids
        const taskId = this.codeIds
        let queryParam = {}
        if (taskId == "0") {
          for (let i = 0; i < task.length; i++) {
            this.mdInTaskList.forEach(item => {
              if (item.inTaskId == task[i]) {
                queryParam.statusCode = 1
                queryParam.inTaskId = item.inTaskId
                modifyReceiptTaskstatus(queryParam).then(response => {
                  if (response.code == 200) {
                    this.$message({
                      message: '任务开始执行',
                      type: 'success'
                    });
                    this.getList()
                  }
                })
              }
            })
          }
        } else {
          this.$message.error("您所选择的任务状态不合规")
        }
      },
      //任务明细按钮
      taskDetails(row) {
        if (row.statusCode != "0") {
          this.$message.error("该任务并非为未执行状态，禁止添加明细")
        } else {
          this.taskNo = row.inTaskNo
          this.$store.state.taskNo = this.taskNo
          this.asset = row.assetsCategory
          this.characteristic = row.inTaskId
          this.opened = true;
          this.text = "添加明细"

        }
      },
      //任务明细添加按钮
      detailsAdd() {
        if (this.asset == "01") {
          listMdMeter(this.queryParam).then(response => {
            this.detailsAddList = response.rows
            this.topic = "添加电能表数据"
            this.untie = true
            this.num = response.total
          })
        } else if (this.asset == "02") {
          listMdIt(this.queryParam).then(response => {
            this.detailsAddList = response.rows
            this.topic = "添加互感器数据"
            this.untie = true
            this.num = response.total
          })
        } else if (this.asset == "03") {
          listMdLcEquip(this.queryParam).then(response => {
            this.detailsAddList = response.rows
            this.topic = "添加采集终端数据"
            this.untie = true
            this.num = response.total
          })
        } else if (this.asset == "04") {
          listMdConcentrator(this.queryParam).then(response => {
            this.detailsAddList = response.rows
            this.topic = "添加采集器数据"
            this.untie = true
            this.num = response.total
          })
        } else if (this.asset == "05") {
          listMdComModule(this.queryParam).then(response => {
            this.detailsAddList = response.rows
            this.topic = "添加通讯模块数据"
            this.untie = true
            this.num = response.total
          })
        } else if (this.asset == "10") {
          listMdOtherMaterial(this.queryParam).then(response => {
            this.detailsAddList = response.rows
            this.topic = "添加其他物资数据"
            this.untie = true
            this.num = response.total
          })
        }
      },
      //添加明细删除按钮
      addDetailsDelete() {
        if (this.selectionArray.length == 0) {
          this.$message.error('至少选择一条数据删除');
        } else {
          if (this.asset == "01") {
            this.$store.commit("addDetailsDelete", {
              indexArray: this.selectionArray
            })
            this.electricInDetailsList = this.$store.state.electricInDetailsList
          } else if (this.asset == "02") {
            this.$store.commit("addDetailsDeleteOne", {
              indexArray: this.selectionArray
            })
            this.transformerInDetailsList = this.$store.state.transformerInDetailsList
          } else if (this.asset == "03") {
            this.$store.commit("addDetailsDeleteTwo", {
              indexArray: this.selectionArray
            })
            this.terminalInDetailsList = this.$store.state.terminalInDetailsList
          } else if (this.asset == "05") {
            this.$store.commit("addDetailsDeleteThree", {
              indexArray: this.selectionArray
            })
            this.moduleInDetailsList = this.$store.state.moduleInDetailsList
          } else if (this.asset == "04") {
            this.$store.commit("addDetailsDeleteFour", {
              indexArray: this.selectionArray
            })
            this.concentratorInDetailsList = this.$store.state.concentratorInDetailsList
          } else if (this.asset == "10") {
            this.$store.commit("addDetailsDeleteFive", {
              indexArray: this.selectionArray
            })
            this.otherInDetailsList = this.$store.state.otherInDetailsList
          }
        }
      },
      //添加电能表任务明细多选框选中数据
      addDetailsSelectionChange(selection) {
        this.detailsSelection = selection.map(item => item)
      },
      //添加互感器任务明细多选框选中数据
      addTransformerDetailsSelectionChange(selection) {
        this.detailsSelection = selection.map(item => item)
      },
      //添加采集终端任务明细多选框选中数据
      addAcquisitionDetailsSelectionChange(selection) {
        this.detailsSelection = selection.map(item => item)
      },
      //添加集中器任务明细多选框选中数据
      addConcentratorDetailsSelectionChange(selection) {
        this.detailsSelection = selection.map(item => item)
      },
      //添加通讯模块任务明细多选框选中数据
      addCommunicationDetailsSelectionChange(selection) {
        this.detailsSelection = selection.map(item => item)
      },
      //添加其他物资任务明细多选框选中数据
      addOtherDetailsSelectionChange(selection) {
        this.detailsSelection = selection.map(item => item)
      },
      oneChange(selection) {
        this.selectionArray = selection.map(item => item)
      },
      twoChange(selection) {
        this.selectionArray = selection.map(item => item)
      },
      threeChange(selection) {
        this.selectionArray = selection.map(item => item)
      },
      fourChange(selection) {
        this.selectionArray = selection.map(item => item)
      },
      fiveChange(selection) {
        this.selectionArray = selection.map(item => item)
      },
      sixChange(selection) {
        this.selectionArray = selection.map(item => item)
      },
      //添加任务明细确定按钮
      define() {
        const detailsSelection = this.detailsSelection
        if (detailsSelection.length == 0) {
          this.$message.error('添加数据时至少选择一条数据');
        } else {
          if (this.asset == "01") {
            this.detailsSelection.forEach(item => {
              this.electricInDetailsList.push({
                assetsCategory: null,
                assetsId: item.meterId,
                equipId: item.equipId,
                inTaskDetailsId: 0,
                inTaskNo: this.taskNo,
                inWhSortCode: null,
                isComplete: null,
                madeNo: item.madeNo,
                nickName: null,
                operationDate: null,
                originalDept: null,
                params: {},
                receiver: null,
                remark: null,
                repeatNumber: 0,
                rfidNo: item.rfidNo,
                sender: null,
                sortCode: this.selectDictLabel(this.dict.type.emi_meter_sort, item.sortCode),
                statusCode: null,
                storeAreaId: null,
                storeAreaName: null,
                storeAreaNo: null,
                storeLocId: null,
                storeLocNo: null,
                targetDept: null,
                typeCode: item.typeCode,
                whAreaId: null,
                whAreaName: null,
                whAreaNo: null,
                whId: null,
                whName: null,
                whNo: null,
                equipCode: item.equipCode,
                equipName: item.equipName,

              })
            })
            this.electricInDetailsList = this.listRemoveRepeat(this.electricInDetailsList)
            this.$store.state.electricInDetailsList = this.electricInDetailsList
          } else if (this.asset == "02") {
            this.detailsSelection.forEach(item => {
              this.transformerInDetailsList.push({
                assetsCategory: null,
                assetsId: item.itId,
                equipId: item.equipId,
                inTaskDetailsId: 0,
                inTaskNo: this.taskNo,
                inWhSortCode: null,
                isComplete: null,
                madeNo: item.madeNo,
                nickName: null,
                operationDate: null,
                originalDept: null,
                params: {},
                receiver: null,
                remark: null,
                repeatNumber: 0,
                rfidNo: item.rfidNo,
                sender: null,
                sortCode: this.selectDictLabel(this.dict.type.tf_sort_code, item.sortCode),
                statusCode: null,
                storeAreaId: null,
                storeAreaName: null,
                storeAreaNo: null,
                storeLocId: null,
                storeLocNo: null,
                targetDept: null,
                typeCode: item.typeCode,
                whAreaId: null,
                whAreaName: null,
                whAreaNo: null,
                whId: null,
                whName: null,
                whNo: null,
                equipCode: item.equipCode,
                equipName: item.equipName,
              })
            })
            this.transformerInDetailsList = this.listRemoveRepeat(this.transformerInDetailsList)
            this.$store.state.transformerInDetailsList = this.transformerInDetailsList
          } else if (this.asset == "03") {
            this.detailsSelection.forEach(item => {
              this.terminalInDetailsList.push({
                assetsCategory: null,
                assetsId: item.lcEquipId,
                equipId: item.equipId,
                inTaskDetailsId: 0,
                inTaskNo: this.taskNo,
                inWhSortCode: null,
                isComplete: null,
                madeNo: item.madeNo,
                nickName: null,
                operationDate: null,
                originalDept: null,
                params: {},
                receiver: null,
                remark: null,
                repeatNumber: 0,
                rfidNo: item.rfidNo,
                sender: null,
                sortCode: null,
                statusCode: null,
                storeAreaId: null,
                storeAreaName: null,
                storeAreaNo: null,
                storeLocId: null,
                storeLocNo: null,
                targetDept: null,
                typeCode: item.typeCode,
                whAreaId: null,
                whAreaName: null,
                whAreaNo: null,
                whId: null,
                whName: null,
                whNo: null,
                equipCode: item.equipCode,
                equipName: item.equipName,
              })
            })
            this.terminalInDetailsList = this.listRemoveRepeat(this.terminalInDetailsList)
            this.$store.state.terminalInDetailsList = this.terminalInDetailsList
          } else if (this.asset == "05") {
            this.detailsSelection.forEach(item => {
              this.moduleInDetailsList.push({
                assetsCategory: null,
                assetsId: item.moduleId,
                inTaskDetailsId: 0,
                inTaskNo: this.taskNo,
                inWhSortCode: null,
                isComplete: null,
                madeNo: item.madeNo,
                nickName: null,
                operationDate: null,
                originalDept: null,
                params: {},
                receiver: null,
                remark: null,
                repeatNumber: 0,
                rfidNo: item.rfidNo,
                sender: null,
                sortCode: null,
                statusCode: null,
                storeAreaId: null,
                storeAreaName: null,
                storeAreaNo: null,
                storeLocId: null,
                storeLocNo: null,
                targetDept: null,
                typeCode: null,
                whAreaId: null,
                whAreaName: null,
                whAreaNo: null,
                whId: null,
                whName: null,
                whNo: null,
                equipCode: item.equipCode,
                equipName: item.equipName,
              })
            })
            this.moduleInDetailsList = this.listRemoveRepeat(this.moduleInDetailsList)
            this.$store.state.moduleInDetailsList = this.moduleInDetailsList
          } else if (this.asset == "04") {
            this.detailsSelection.forEach(item => {
              this.concentratorInDetailsList.push({
                assetsCategory: null,
                assetsId: item.concentratorId,
                inTaskDetailsId: 0,
                inTaskNo: this.taskNo,
                inWhSortCode: null,
                isComplete: null,
                madeNo: item.madeNo,
                nickName: null,
                operationDate: null,
                originalDept: null,
                params: {},
                receiver: null,
                remark: null,
                repeatNumber: 0,
                rfidNo: item.rfidNo,
                sender: null,
                sortCode: null,
                statusCode: null,
                storeAreaId: null,
                storeAreaName: null,
                storeAreaNo: null,
                storeLocId: null,
                storeLocNo: null,
                targetDept: null,
                typeCode: item.typeCode,
                whAreaId: null,
                whAreaName: null,
                whAreaNo: null,
                whId: null,
                whName: null,
                whNo: null,
                equipCode: item.equipCode,
                equipName: item.equipName,
              })
            })
            this.concentratorInDetailsList = this.listRemoveRepeat(this.concentratorInDetailsList)
            this.$store.state.concentratorInDetailsList = this.concentratorInDetailsList
          } else if (this.asset == "10") {
            this.detailsSelection.forEach(item => {
              this.otherInDetailsList.push({
                assetsCategory: null,
                assetsId: item.otherMaterialId,
                inTaskDetailsId: 0,
                inTaskNo: this.taskNo,
                inWhSortCode: null,
                isComplete: null,
                madeNo: null,
                nickName: null,
                operationDate: null,
                originalDept: null,
                params: {},
                receiver: null,
                remark: null,
                repeatNumber: 0,
                rfidNo: item.barCode,
                sender: null,
                sortCode: null,
                statusCode: null,
                storeAreaId: null,
                storeAreaName: null,
                storeAreaNo: null,
                storeLocId: null,
                storeLocNo: null,
                targetDept: null,
                typeCode: null,
                whAreaId: null,
                whAreaName: null,
                whAreaNo: null,
                whId: null,
                whName: null,
                whNo: null,
                equipCode: item.equipCode,
                equipName: item.equipName,
              })
            })
            this.otherInDetailsList = this.listRemoveRepeat(this.otherInDetailsList)
            this.$store.state.otherInDetailsList = this.otherInDetailsList
          }
          this.untie = false
        }
      },
      beSure() {
        this.$confirm('此操作将添加所有资产, 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          if (this.asset == "01") {
            if (this.electricInDetailsList == "") {
              this.$message.error('页面中没有数据可供添加')
            } else {
              this.loadToast = true
              addReceiptDetails(this.electricInDetailsList).then(response => {
                if (response.code == 200) {
                  this.$message({
                    type: 'success',
                    message: '添加成功!'
                  });
                  this.electricInDetailsList = []
                  this.loadToast = false
                  this.opened = false
                } else {
                  this.$message.error('添加失败')
                  this.loadToast = false
                }
              }).catch(() => {
                this.loadToast = false
              })
            }
          } else if (this.asset == "02") {
            if (this.transformerInDetailsList == "") {
              this.$message.error('页面中没有数据可供添加')
            } else {
              this.loadToast = true
              addReceiptDetails(this.transformerInDetailsList).then(response => {
                if (response.code == 200) {
                  this.$message({
                    type: 'success',
                    message: '添加成功!'
                  });
                  this.transformerInDetailsList = []
                  this.loadToast = false
                  this.opened = false
                } else {
                  this.$message.error('添加失败')
                  this.loadToast = false
                }
              }).catch(() => {
                this.loadToast = false
              })
            }
          } else if (this.asset == "03") {
            if (this.terminalInDetailsList == "") {
              this.$message.error('页面中没有数据可供添加')
            } else {
              this.loadToast = true
              addReceiptDetailsaddReceiptDetails(this.terminalInDetailsList).then(response => {
                if (response.code == 200) {
                  this.$message({
                    type: 'success',
                    message: '添加成功!'
                  });
                  this.terminalInDetailsList = []
                  this.loadToast = false
                  this.opened = false
                } else {
                  this.$message.error('添加失败')
                  this.loadToast = false
                }
              }).catch(() => {
                this.loadToast = false
              })
            }
          } else if (this.asset == "05") {
            if (this.moduleInDetailsList == "") {
              this.$message.error('页面中没有数据可供添加')
            } else {
              this.loadToast = true
              addReceiptDetails(this.moduleInDetailsList).then(response => {
                if (response.code == 200) {
                  this.$message({
                    type: 'success',
                    message: '添加成功!'
                  });
                  this.moduleInDetailsList = []
                  this.loadToast = false
                  this.opened = false
                } else {
                  this.$message.error('添加失败')
                  this.loadToast = false
                }
              }).catch(() => {
                this.loadToast = false
              })
            }
          } else if (this.asset == "04") {
            if (this.concentratorInDetailsList == "") {
              this.$message.error('页面中没有数据可供添加')
            } else {
              this.loadToast = true
              addReceiptDetails(this.concentratorInDetailsList).then(response => {
                if (response.code == 200) {
                  this.$message({
                    type: 'success',
                    message: '添加成功!'
                  });
                  this.concentratorInDetailsList = []
                  this.loadToast = false
                  this.opened = false
                } else {
                  this.$message.error('添加失败')
                  this.loadToast = false
                }
              }).catch(() => {
                this.loadToast = false
              })
            }
          } else if (this.asset == "10") {
            if (this.transformerInDetailsList == "") {
              this.$message.error('页面中没有数据可供添加')
            } else {
              this.loadToast = true
              addReceiptDetails(this.otherInDetailsList).then(response => {
                if (response.code == 200) {
                  this.$message({
                    type: 'success',
                    message: '添加成功!'
                  });
                  this.otherInDetailsList = []
                  this.loadToast = false
                  this.opened = false
                } else {
                  this.$message.error('添加失败')
                  this.loadToast = false
                }
              }).catch(() => {
                this.loadToast = false
              })
            }
          }
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '已取消添加'
          });
        });
      },
      //去重表格选择数据
      listRemoveRepeat(x) {
        let result = [];
        for (let i = 0; i < x.length; i++) {
          let flag = true;
          let temp = x[i];
          for (let j = 0; j < result.length; j++) {
            // 普通数组 (temp === result[j])
            if (temp.assetsId === result[j].assetsId) {
              flag = false;
              break;
            }
          }
          if (flag) {
            result.push(temp);
          }
        }
        return result;
      },
      //处理明细按钮
      processingDetails(row) {
        this.inTask = row.inTaskNo
        this.taskId = row.inTaskId
        this.taskOrderTypeCode = row.taskOrderType
        const pageSize = this.inquireAbout.pageSize
        const pageNum = this.inquireAbout.pageNum
        this.inquireAbout = {
          pageNum: pageNum,
          pageSize: pageSize,
          inTaskNo: row.inTaskNo || this.inTask
        }
        this.cateGory = row.assetsCategory
        queryDetailsList(this.inquireAbout).then(response => {
          if (response.code == 200) {
            this.detailsList = response.rows
            this.processing = true;
            this.processingText = "处理明细"
            this.figure = response.total
          }
        }).catch()
      },
      //处理明细刷新操作
      processingDetail() {
        const pageSize = this.inquireAbout.pageSize
        const pageNum = this.inquireAbout.pageNum
        this.inquireAbout = {
          pageNum: pageNum,
          pageSize: pageSize,
          inTaskNo: this.inTask
        }
        queryDetailsList(this.inquireAbout).then(response => {
          if (response.code == 200) {
            this.detailsList = response.rows
            this.processing = true;
            this.processingText = "处理明细"
            this.figure = response.total
          }
        })
      },
      //处理明细选中数据
      processDetails(selection) {
        this.processingSelsctArray = selection.map(item => item)
        this.inTaskDetailsIds = selection.map(item => item.inTaskDetailsId)
        this.wareHousingNo = selection.map(item => item.inTaskNo)
        this.equipId = selection.map(item => item.equipId)
        this.alone = selection.length !== 1
        this.several = !selection.length
      },
      //处理明细删除按钮
      deleteProcessingDetails() {
        const inTaskDetailsIds = this.inTaskDetailsIds
        const inTaskNo = this.inTask
        this.$confirm('此操作将永久删除该资产, 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          return delMdInTaskDetails(inTaskDetailsIds, inTaskNo).then(response => {
            if (response.code == 200) {
              this.$message({
                type: 'success',
                message: '删除成功!'
              });
              this.processingDetail();
            } else {
              this.$message.error("删除失败")
            }
          })
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '已取消删除'
          });
        });
      },

      //查看入库明细
      watchDetailsInfo(row) {
        this.inTask = row.inTaskNo
        this.taskId = row.inTaskId
        this.taskOrderTypeCode = row.taskOrderType
        const pageSize = this.inquireAbout.pageSize
        const pageNum = this.inquireAbout.pageNum
        this.inquireAbout = {
          pageNum: pageNum,
          pageSize: pageSize,
          inTaskNo: row.inTaskNo || this.inTask
        }
        this.cateGory = row.assetsCategory
        queryDetailsList(this.inquireAbout).then(response => {
          if (response.code == 200) {
            this.detailsList = response.rows
            this.watchInfo = true;
            this.watchInfoText = "查看明细"
            this.figure = response.total
          }
        }).catch()
      },
      //入库执行按钮
      warehousingExecution() {
        // selectMdWhInfo().then(response => {
        //   this.option = response.data
        //   this.wareHouseForm.whId = this.option[0].value
        //   this.changeWhId()
        // })
        // setTimeout(() => {
        //   this.toast = true
        //   this.carryOutText = "入库执行"
        // }, 500);
      },
      //入库执行页面确认按钮
      startBeSureExecution() {
        this.houseForm = []
        this.processingSelsctArray.forEach(item => {
          item.whId = this.wareHouseForm.whId
          item.whAreaId = this.wareHouseForm.whAreaId
          item.storeAreaId = this.wareHouseForm.storeAreaId
          item.storeLocId = this.wareHouseForm.storeLocId
          this.houseForm.push(item)
        })
        let queryParams = {
          assetsCategory: this.cateGory,
          inTaskId: this.taskId,
          inTaskNo: this.inTask,
          equipId: this.equipId,
          mdInTaskDetailsList: this.houseForm
        }
        this.$refs["wareHouseForm"].validate(valid => {
          if (valid) {
            startBeSureDetailsExecution(queryParams).then(response => {
              this.loadToast = true
              if (response.code == 200) {
                this.$modal.msgSuccess("执行成功");
                this.loadToast = false
                this.toast = false;
                this.processingDetail()
              } else {
                this.loadToast = false
              }
            }).catch(() => {
              this.toast = false;
            });
          }
        });
      },
      //库房下拉框改变事件
      changeWhId() {
        let queryParams = {}
        queryParams.whId = this.wareHouseForm.whId
        selectMdStorageAreaInfo(queryParams).then(response => {
          this.options = response.data
        })
      },
      //库区下拉框改变事件
      changeWhAreaId() {
        //定义请求查询参数
        let queryParams = {}
        //对查询参数进行赋值
        queryParams.whId = this.wareHouseForm.whId
        queryParams.whAreaId = this.wareHouseForm.whAreaId
        //改变的时候，将存放区以及储位设置为空
        this.wareHouseForm.storeAreaId = null;
        this.wareHouseForm.storeLocId = null;
        this.storageOption = []
        //进行请求
        selectMdSaInfo(queryParams).then(response => {
          this.optionss = response.data
        })
      },
      //存放区下拉框改变事件
      changeStoreAreaId() {
        let queryParams = {}
        queryParams.whId = this.wareHouseForm.whId
        queryParams.whAreaId = this.wareHouseForm.whAreaId
        queryParams.storeAreaId = this.wareHouseForm.storeAreaId
        this.wareHouseForm.storeLocId = null;
        selectStorageLocation(queryParams).then(response => {
          this.storageOption = response.data
        })
      },
      //关闭添加明细对话框
      closeDetails() {
        this.opened = false
        this.electricInDetailsList = []
        this.transformerInDetailsList = []
        this.terminalInDetailsList = []
        this.moduleInDetailsList = []
        this.concentratorInDetailsList = []
        this.otherInDetailsList = []
      },
      //关闭级联选择对话框
      closeChoose() {
        this.toast = false
        this.wareHouseForm.whId = null
        this.wareHouseForm.whAreaId = null
        this.wareHouseForm.storeAreaId = null
        this.wareHouseForm.storeLocId = null
      },
      //关闭处理明细层
      closeProcessing() {
        this.processing = false
        this.getList()
      },

      //关闭查看明细层
      closeWatchInfo() {
        this.watchInfo = false
        this.getList()
      },
      //任务完成按钮
      accomplished() {
        const taskId = this.codeIds
        const task = this.ids
        let queryParam = {}
        if (taskId == "1") {
          for (let i = 0; i < task.length; i++) {
            this.mdInTaskList.forEach(item => {
              if (item.inTaskId == task[i]) {
                queryParam.statusCode = 2
                queryParam.inTaskId = item.inTaskId
                modifyReceiptTaskstatus(queryParam).then(response => {
                  if (response.code == 200) {
                    this.$message({
                      message: '任务执行完成',
                      type: 'success'
                    });
                    this.getList()
                  }
                })
              }
            })
          }
        } else {
          this.$message.error("您所选择的任务状态不合规")
        }
      },
      //下载数据按钮
      downloadData() {
        if (this.ids.length == 0) {
          let array = [];
          this.mdInTaskList.forEach(item => {
            if (item.statusCode == '1') {
              array.push(item.inTaskId)
            }
          })
          let queryParams = {
            inTaskIds: array
          }
          if (array != "") {
            this.$confirm('此操作将下载所有文件, 是否继续?', '提示', {
              confirmButtonText: '确定',
              cancelButtonText: '取消',
              type: 'warning'
            }).then(() => {
              jsonMdInTask(queryParams).then(response => {
                if (response.code == 200) {
                  this.$message({
                    message: `数据成功下载至${response.msg}中`,
                    type: 'success'
                  });
                } else {
                  this.$message.error('数据下载失败');
                }
              })
            }).catch(() => {
              this.$message({
                type: 'info',
                message: '已取消下载'
              });
            });
          } else {
            this.$message.error('当前页面数据全未为开始执行状态');
          }
        } else {
          let queryParams = {
            inTaskIds: JSON.parse(JSON.stringify(this.ids))
          }
          const inTaskId = this.ids
          for (let i = 0; i < inTaskId.length; i++) {
            this.mdInTaskList.forEach(item => {
              if (item.inTaskId == inTaskId[i]) {
                if (item.statusCode != '1') {
                  this.$message.error(`单据${inTaskId[i]}不是开始执行状态，请重新选择!`);
                } else {
                  jsonMdInTask(queryParams).then(response => {
                    if (response.code == 200) {
                      this.$message({
                        message: `数据成功下载至${response.msg}中`,
                        type: 'success'
                      });
                    } else {
                      this.$message.error('数据下载失败');
                    }
                  })
                }
              }
            })
          }
        }
      }
    }
  };
</script>
